﻿using System;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
	// Token: 0x020005EF RID: 1519
	[AddComponentMenu("Image Effects/Other/Screen Overlay")]
	[RequireComponent(typeof(Camera))]
	[ExecuteInEditMode]
	public class ScreenOverlay : PostEffectsBase
	{
		// Token: 0x06001DE5 RID: 7653 RVA: 0x00012DFB File Offset: 0x00010FFB
		public override bool CheckResources()
		{
			base.CheckSupport(false);
			this.overlayMaterial = base.CheckShaderAndCreateMaterial(this.overlayShader, this.overlayMaterial);
			if (!this.isSupported)
			{
				base.ReportAutoDisable();
			}
			return this.isSupported;
		}

		// Token: 0x06001DE6 RID: 7654 RVA: 0x0006CF5C File Offset: 0x0006B15C
		public void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			if (!this.CheckResources())
			{
				Graphics.Blit(source, destination);
				return;
			}
			Vector4 vector = new Vector4(1f, 0f, 0f, 1f);
			this.overlayMaterial.SetVector("_UV_Transform", vector);
			this.overlayMaterial.SetFloat("_Intensity", this.intensity);
			this.overlayMaterial.SetTexture("_Overlay", this.texture);
			Graphics.Blit(source, destination, this.overlayMaterial, (int)this.blendMode);
		}

		// Token: 0x040017C8 RID: 6088
		public ScreenOverlay.OverlayBlendMode blendMode = ScreenOverlay.OverlayBlendMode.Overlay;

		// Token: 0x040017C9 RID: 6089
		public float intensity = 1f;

		// Token: 0x040017CA RID: 6090
		public Texture2D texture;

		// Token: 0x040017CB RID: 6091
		public Shader overlayShader;

		// Token: 0x040017CC RID: 6092
		public Material overlayMaterial;

		// Token: 0x020005F0 RID: 1520
		public enum OverlayBlendMode
		{
			// Token: 0x040017CE RID: 6094
			Additive,
			// Token: 0x040017CF RID: 6095
			ScreenBlend,
			// Token: 0x040017D0 RID: 6096
			Multiply,
			// Token: 0x040017D1 RID: 6097
			Overlay,
			// Token: 0x040017D2 RID: 6098
			AlphaBlend
		}
	}
}
